import instance from "@/util/axios";

// 获取广告种类
export const getAdCategoryList = () => instance.get('/adCategory/list')

// 获取广告列表
export const getAdList = () => instance.get('/advertisement/list')

// 定义分页查询广告的方法
export const getAdByPage = (page, pageSize) =>
  instance.get('/advertisement/findByPage', {
    params: { page, pageSize },
  });

// 搜索广告
export const searchAd = (page, pageSize, data) =>
  instance.post(
    `/advertisement/search/${page}/${pageSize}`, // 请求路径
    data, // 请求体中的 JSON 数据
  );

export const addAd = (data) =>
  instance.post('/advertisement/add', data)

// 更新广告
export const updateAd = (data) =>
  instance.put('/advertisement/update', data)

// 删除广告
export const deleteAd = (ids) =>
  instance.delete(`/advertisement/delete/${ids}`)

export const getOssSignature =
  () => instance.get('/oss/get_post_signature_for_oss_upload')
